package com.stars.services.impl.system;

import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.system.SysAreaDTO;
import com.stars.dao.mapper.system.SysAreaMapper;
import com.stars.entity.system.SysAreaEntity;
import com.stars.services.system.SysAreaAccessServices;
import com.stars.dao.mapper.system.SysAreaMapper;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 全国行政区数据 业务逻辑
 * @author DJ
 * @date 2019-11-07
 * @version V1.0
 *
 */
@Service
public class SysAreaAccessServicesImpl  extends BaseAccessServiceImpl<SysAreaMapper , SysAreaEntity> implements  SysAreaAccessServices {
    @Autowired
    private SysAreaMapper  sysAreaMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<SysAreaDTO> pageList(Integer pageNum, Integer pageSize, SysAreaDTO dto) throws Exception{
        ListPage<SysAreaDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<SysAreaDTO> list = sysAreaMapper.pageQuerySysArea(listPage);
        PageInfo<SysAreaDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
